import logging as logger
from fastapi import FastAPI
from contextlib import asynccontextmanager
from core.database import init_db
from api.routes import api_router
logger.basicConfig(level=logger.DEBUG)
mode = False
@asynccontextmanager
async def lifespan(app: FastAPI):
    await init_db(mode)
    yield

app = FastAPI(title='贵宾车项目接口文档',
              lifespan=lifespan,
              debug=True)

app.include_router(api_router)
if __name__ == '__main__':
    import sys,uvicorn
    sys.exit(uvicorn.run('main:app',reload=True,log_level="debug"))